package com.cash.loan.modular.cash.dao;

import com.cash.loan.modular.cash.model.LoanProduct;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.cash.loan.modular.cash.transfer.vo.ProductDetailVo;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 借款产品表 Mapper 接口
 * </p>
 *
 * @author yangbo123
 * @since 2018-07-09
 */
public interface LoanProductMapper extends BaseMapper<LoanProduct> {

    /**
     * 得到最新的四个口子
     * @return
     */
    List<LoanProduct> getNewLimitProduct();

    /**
     * 得到所有热门口子
     * @return
     */
    List<LoanProduct> getHotProduct();

    /**
     * 得到前5推荐位产品
     */
    List<LoanProduct> getRecommendProduct();

    /**
     * 得到产品详情
     * @param productId
     * @return
     */
    ProductDetailVo getLoanProductDetail(@Param("id") Integer productId);

    /**
     * 根据条件获取产品列表
     * @param minLoanTerm
     * @param maxLoanTerm
     * @param minLoanAmount
     * @param maxLoanAmount
     * @param orderBy
     * @return
     */
    List<LoanProduct> getProductByConditions(@Param("minLoanTerm") Integer minLoanTerm,
                         @Param("maxLoanTerm") Integer maxLoanTerm,
                         @Param("minLoanAmount") BigDecimal minLoanAmount,
                         @Param("maxLoanAmount") BigDecimal maxLoanAmount,
                         @Param("orderBy") String orderBy,
                         @Param("cateId") Integer cateId);

    /**
     * 得到申请页面地址
     * @param productId
     * @return
     */
    String getApplyUrl(@Param("productId") Integer productId);

    /**
     * 获得下载标识
     * @param productId
     * @return
     */
    Integer getDownloadFlag(@Param("productId") Long productId);
}
